package com.genexususa.eo.bing.data.wsSubclasses;

import com.genexususa.eo.bing.CampaignManagementServiceClasses.Date;
import org.w3c.dom.Element;
import org.w3c.dom.Node;

public class GxDate extends Date {
    public GxDate(Element element) {
        if (element.getElementsByTagName("Day").getLength() > 0 &&
            element.getElementsByTagName("Day").item(0).getChildNodes().getLength() > 0) {
            this.setDay(Integer.valueOf(((Node) element.getElementsByTagName("Day").item(0).getChildNodes().item(0)).getNodeValue()));
        }
        if (element.getElementsByTagName("Month").getLength() > 0 &&
            element.getElementsByTagName("Month").item(0).getChildNodes().getLength() > 0) {
            this.setMonth(Integer.valueOf(((Node) element.getElementsByTagName("Month").item(0).getChildNodes().item(0)).getNodeValue()));
        }
        if (element.getElementsByTagName("Year").getLength() > 0 &&
            element.getElementsByTagName("Year").item(0).getChildNodes().getLength() > 0) {
            this.setYear(Integer.valueOf(((Node) element.getElementsByTagName("Year").item(0).getChildNodes().item(0)).getNodeValue()));
        }
    }
}
